package com.cyan.app.workflow.activity.UserCenter;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.cyan.app.workflow.R;
import com.cyan.app.workflow.base.activity.BaseActivity;
import com.cyan.app.workflow.bean.SalaryBean;

/**
 * Created by DXW on 2016/2/28.
 */
public class SalaryDetailActivity extends BaseActivity {
    private SalaryBean salaryBean;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_salary_detail);
        salaryBean =  (SalaryBean)getIntent().getSerializableExtra("salaryDetail");
        titleBar();
        initData();

    }

    private void titleBar() {
        TextView mTitleName = (TextView) findViewById(R.id.top_title_info);
        mTitleName.setText("工资明细   " + salaryBean.getYearMonth());
        Button back = (Button) findViewById(R.id.top_title_back);
        back.getBackground().setAlpha(255);// 透明度0~255透明度值 ，值越小越透明
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //返回按钮
                finish();
            }
        });
    }

    private void initData(){
        TextView jiben = (TextView)findViewById(R.id.user_salary_detail_jiben);
        if(!salaryBean.getJiBen().equals("0.00")||!salaryBean.getJiBen().equals("0")) {
            jiben.setText(salaryBean.getJiBen());
        }else {
            jiben.setText("");
        }

        TextView jishu = (TextView)findViewById(R.id.user_salary_detail_jishu);
        if(!salaryBean.getJiShu().equals("0.00")||!salaryBean.getJiShu().equals("0")) {
            jishu.setText(salaryBean.getJiShu());
        }else {
            jishu.setText("");
        }

        TextView gangwei = (TextView)findViewById(R.id.user_salary_detail_gangwei);
        if(!salaryBean.getGangWei().equals("0.00")||!salaryBean.getGangWei().equals("0")) {
            gangwei.setText(salaryBean.getGangWei());
        }else {
            gangwei.setText("");
        }

        TextView jixiao = (TextView)findViewById(R.id.user_salary_detail_jixiao);
        if(!salaryBean.getJiXiao().equals("0.00")||!salaryBean.getJiXiao().equals("0")) {
            jixiao.setText(salaryBean.getJiXiao());
        }else {
            jixiao.setText("");
        }

        TextView chuqin = (TextView)findViewById(R.id.user_salary_detail_chuqin);
        if(!salaryBean.getChuQin().equals("0.00")||!salaryBean.getChuQin().equals("0")) {
            chuqin.setText(salaryBean.getChuQin());
        }else {
            chuqin.setText("");
        }

        TextView yingfa = (TextView)findViewById(R.id.user_salary_detail_yingfa);
        if(!salaryBean.getYingFa().equals("0.00")||!salaryBean.getYingFa().equals("0")) {
            yingfa.setText(salaryBean.getYingFa());
        }else {
            yingfa.setText("");
        }

        TextView jiaban = (TextView)findViewById(R.id.user_salary_detail_jiaban);
        if(!salaryBean.getJiaBan().equals("0.00")||!salaryBean.getJiaBan().equals("0")) {
            jiaban.setText(salaryBean.getJiaBan());
        }else {
            jiaban.setText("");
        }

        TextView yeban = (TextView)findViewById(R.id.user_salary_detail_yeban);
        if(!salaryBean.getYeBan().equals("0.00")||!salaryBean.getYeBan().equals("0")) {
            yeban.setText(salaryBean.getYeBan());
        }else {
            yeban.setText("");
        }

        TextView fangbu = (TextView)findViewById(R.id.user_salary_detail_fangbu);
        if(!salaryBean.getFangBu().equals("0.00")||!salaryBean.getFangBu().equals("0")) {
            fangbu.setText(salaryBean.getFangBu());
        }else {
            fangbu.setText("");
        }

        TextView butie = (TextView)findViewById(R.id.user_salary_detail_butie);
        if(!salaryBean.getBuTie().equals("0.00")||!salaryBean.getBuTie().equals("0")) {
            butie.setText(salaryBean.getBuTie());
        }else {
            butie.setText("");
        }

        TextView yingfaheji = (TextView)findViewById(R.id.user_salary_detail_yingfaheji);
        if(!salaryBean.getYingFaHeJi().equals("0.00")||!salaryBean.getYingFaHeJi().equals("0")) {
            yingfaheji.setText(salaryBean.getYingFaHeJi());
        }else {
            yingfaheji.setText("");
        }

        TextView yingkou = (TextView)findViewById(R.id.user_salary_detail_yingkou);
        if(!salaryBean.getYingKou().equals("0.00")||!salaryBean.getYingKou().equals("0")) {
            yingkou.setText(salaryBean.getYingKou());
        }else {
            yingkou.setText("");
        }

        TextView daikou = (TextView)findViewById(R.id.user_salary_detail_daikou);
        if(!salaryBean.getDaiKou().equals("0.00")||!salaryBean.getDaiKou().equals("0")) {
            daikou.setText(salaryBean.getDaiKou());
        }else {
            daikou.setText("");
        }

        TextView geshui = (TextView)findViewById(R.id.user_salary_detail_geshui);
        if(!salaryBean.getGeShui().equals("0.00")||!salaryBean.getGeShui().equals("0")) {
            geshui.setText(salaryBean.getGeShui());
        }else {
            geshui.setText("");
        }

        TextView chidao = (TextView)findViewById(R.id.user_salary_detail_chidao);
        if(!salaryBean.getChiDao().equals("0.00")||!salaryBean.getChiDao().equals("0")) {
            chidao.setText(salaryBean.getChiDao());
        }else {
            chidao.setText("");
        }
        //房租
        TextView fangzu = (TextView)findViewById(R.id.user_salary_detail_fangzu);
        if(!salaryBean.getFangZu().equals("0.00")||!salaryBean.getFangZu().equals("0")) {
            fangzu.setText(salaryBean.getFangZu());
        }else {
            fangzu.setText("");
        }

        TextView koukuan = (TextView)findViewById(R.id.user_salary_detail_koukuan);
        if(!salaryBean.getKouKuan().equals("0.00")||!salaryBean.getKouKuan().equals("0")) {
            koukuan.setText(salaryBean.getKouKuan());
        }else {
            koukuan.setText("");
        }

        TextView shifa = (TextView)findViewById(R.id.user_salary_detail_shifa);
        if(!salaryBean.getShiFa().equals("0.00")|| !salaryBean.getShiFa().equals("0")) {
            shifa.setText(salaryBean.getShiFa());
        }else {
            shifa.setText("");
        }
    }
}
